package com.lut.adapter;

/**
 * @author liuning
 * @ProjectName GOF23
 * @time 2021/12/21 21:13
 */
//客户端类：想上网，插不上网线
public class Computer {
    //我们的电脑需要连接上转接器才可以上网
    public void net(NetToUsb adapter){
        //上网的具体实现，找一个转接头
        adapter.handleRequest();
    }

    public static void main(String[] args) {
        //电脑、适配器、网线
        //类似无限网卡
        Computer computer = new Computer();//电脑
        Adapter adapter = new Adapter();//网线
        AdapterTools adapterTools = new AdapterTools();//转接器

        computer.net(adapterTools);
        //热插拔式
        Adapter adapter2 = new Adapter();//网线
        AdapterTools2 adapterTools2 = new AdapterTools2(adapter2);//转接器

        computer.net(adapterTools2);
    }
}
